Skip to content

refactor: centralize search route ownership#752

Closed
BigSimmo wants to merge 1 commit into
mainfrom
codex/implement-full-stack-architecture-improvement
Closed

refactor: centralize search route ownership#752
BigSimmo wants to merge 1 commit into
mainfrom
codex/implement-full-stack-architecture-improvement

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Motivation

  • The shared search shell duplicated the dashboard-vs-route submitted-search decision in two client paths, causing a recurring regression risk when modes changed.
  • Centralize that responsibility into a small pure boundary to make the routing decision explicit, typed, and testable.

Description

  • Add a pure routing boundary src/lib/search-route-ownership.ts that exposes shouldRenderDashboardSearch and shouldRenderClinicalDashboard and encodes the canonical set of route-owned modes.
  • Update src/components/clinical-dashboard/global-search-shell.tsx to consume the new boundary instead of repeating mode/mocking/match conditionals, and simplify autoRunSearch seeding.
  • Add tests/search-route-ownership.test.ts with coverage for route-owned modes, dashboard-owned flows, medication detail routes, and mockups, and update tests/therapy-compass-mode-wiring.test.ts to assert the new policy.
  • Update docs: docs/frontend-architecture.md notes the new responsibility, and docs/branch-review-ledger.md records the review entry.

Testing

  • Ran focused unit tests: vitest on tests/search-route-ownership.test.ts and tests/therapy-compass-mode-wiring.test.ts (2 files, 7 tests) and all passed.
  • Ran repository gates: npm run verify:cheap completed successfully and npm run verify:pr-local completed in this environment.
  • Started the local dev server with npm run ensure and validated http://localhost:3131/api/local-project-id returned the project identity.
  • npm run test:e2e:critical / npm run verify:ui could not complete because the isolated production Playwright build repeatedly failed to download required font assets from fonts.gstatic.com, so the full Chromium UI gate was blocked.

Codex Task

Summary by CodeRabbit

  • New Features
    • Centralized search-route ownership so submitted searches follow the correct route-specific workflow vs the clinical dashboard experience.
  • Bug Fixes
    • Prevented the dashboard search layer from incorrectly replacing route-owned workflows, including Therapy Compass and other specialized modes.
    • Ensured medication-detail and document-search mockup paths keep their dedicated experiences.
  • Documentation
    • Updated frontend architecture guidance and review documentation to reflect the revised ownership behavior.
  • Tests
    • Added and expanded automated coverage for the routing/selection scenarios.

@supabase

supabase Bot commented Jul 17, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e23f1f8a-6413-40da-8c81-31cfcd807674

📥 Commits

Reviewing files that changed from the base of the PR and between eb22c6e and b7d71f8.

📒 Files selected for processing (6)
  • docs/branch-review-ledger.md
  • docs/frontend-architecture.md
  • src/components/clinical-dashboard/global-search-shell.tsx
  • src/lib/search-route-ownership.ts
  • tests/search-route-ownership.test.ts
  • tests/therapy-compass-mode-wiring.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • tests/search-route-ownership.test.ts
  • tests/therapy-compass-mode-wiring.test.ts
  • src/lib/search-route-ownership.ts
  • src/components/clinical-dashboard/global-search-shell.tsx

📝 Walkthrough

Walkthrough

The PR centralizes submitted-search route ownership in typed helpers, wires those helpers into GlobalSearchShell, adds direct Vitest coverage for route and mode behavior, updates Therapy Compass wiring tests, and documents the routing boundary and verification record.

Changes

Search route ownership

Layer / File(s) Summary
Ownership helpers and behavioral coverage
src/lib/search-route-ownership.ts, tests/search-route-ownership.test.ts, tests/therapy-compass-mode-wiring.test.ts
Adds shared helpers for route-owned searches, dashboard rendering, medication-detail exclusions, and document-search mockup exclusions, with direct tests for these cases.
GlobalSearchShell integration
src/components/clinical-dashboard/global-search-shell.tsx
Replaces local routing conditions with the shared helpers and updates homepage search execution and standalone-mode state.
Architecture and review records
docs/frontend-architecture.md, docs/branch-review-ledger.md
Documents the routing boundary and records the branch review scope and verification status.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change and testing, but it does not follow the required template sections or include the verification checklist. Add the template sections in order, including Summary, Verification, Risk and rollout, Clinical Governance Preflight, and Notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change: centralizing search route ownership.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/implement-full-stack-architecture-improvement

Comment @coderabbitai help to get the list of available commands.

@BigSimmo

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

@BigSimmo
BigSimmo marked this pull request as ready for review July 17, 2026 19:36
@BigSimmo
BigSimmo enabled auto-merge July 17, 2026 19:36
auto-merge was automatically disabled July 17, 2026 19:42

Head branch was pushed to by a user without write access

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts and merged the latest origin/main into this branch in commit eb22c6ec.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/therapy-compass-mode-wiring.test.ts`:
- Around line 29-33: Extend the therapy-compass test beyond direct
shouldRenderDashboardSearch coverage by asserting the rendered route wiring
through GlobalSearchShell (or its equivalent integration boundary). Verify that
/therapy-compass with a submitted query and run parameter renders
TherapyCompassPage and not ClinicalDashboard, while preserving the existing
helper assertion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d355878f-6f40-47bb-8f9e-0b3a6c587150

📥 Commits

Reviewing files that changed from the base of the PR and between b04c95f and eb22c6e.

📒 Files selected for processing (6)
  • docs/branch-review-ledger.md
  • docs/frontend-architecture.md
  • src/components/clinical-dashboard/global-search-shell.tsx
  • src/lib/search-route-ownership.ts
  • tests/search-route-ownership.test.ts
  • tests/therapy-compass-mode-wiring.test.ts

Comment thread tests/therapy-compass-mode-wiring.test.ts
@cursor
cursor Bot force-pushed the codex/implement-full-stack-architecture-improvement branch from eb22c6e to b7d71f8 Compare July 17, 2026 20:15
@BigSimmo BigSimmo closed this Jul 18, 2026
auto-merge was automatically disabled July 18, 2026 06:11

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants